//
//  JMNoDataView.m
//  NewiOSProject
//
//  Created by li on 2023/9/14.
//  Copyright © 2023 范智渊. All rights reserved.
//

#import "JMNoDataView.h"
#import "CustomStackView.h"
#import "PaddingView.h"
@implementation JMNoDataView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        CustomStackView *stack_v = [CustomStackView init:(UILayoutConstraintAxisVertical)];
        stack_v.spacing = 26;
        stack_v.alignment = UIStackViewAlignmentCenter;
        
        UIImageView *icon = [UIImageView new];
        self.icon = icon;
        icon.contentMode = UIViewContentModeScaleAspectFit;
        icon.image = [UIImage imageNamed:@"noData"];
        [icon.widthAnchor constraintEqualToConstant:210].active = YES;
        [icon.heightAnchor constraintEqualToConstant:210].active = YES;
        [stack_v addArrangedSubview:icon];
        
        UILabel *titleLab = [UILabel new];
        titleLab.font = [UIFont systemFontOfSize:16 weight:(UIFontWeightBold)];
        titleLab.textColor = [UIColor colorWithHexString:@"#222220"];
        titleLab.textAlignment = NSTextAlignmentCenter;
        titleLab.text = @"Sin señal o sin contenido";
        [stack_v addArrangedSubview:titleLab];
        
        [self addSubview:[PaddingView initWithContentView:stack_v edgeInsets:(UIEdgeInsetsZero)]];
        self.paddingView = stack_v.superview;
        stack_v.superview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
